XML publishing by middleware or with direct DBMS support has been well studied, and techniques are rapidly being introduced into commercial products. In some applications, small portions of a database are extracted into “disposable” XML documents, for example, the messages needed to execute or respond to requests using a web-services protocol. However, in many applications including mediation, archiving and web site management, large XML documents may need to be exported. In this case, the cached XML document can be seen as a view of the database instance. For all the reasons that efficient incremental maintenance of views in the database is important, it may also make sense to incrementally update published XML documents, even when they are externally cached by a middleware system. There are no known techniques for incremental evaluation of XML publishing of relational data.
Schema-directed publishing extracts data from a relational database and constructs an XML view that conforms to a predefined schema, such as a Document Type Description (DTD). For example, enterprises typically agree on a common schema for data exchange; thus, a specification for publishing views that ensures schema conformance is an important benefit for developers. In response to this need, the Attribute Translation Grammar (ATG) formalism has been developed, as described in M. Benedikt et al., “DTD-Directed Publishing with Attribute Translation Grammars.” VLDB (2002) (hereinafter, referred to as “Benedikt et al.”). Generally, an ATG is a mapping (σ: R→D) associated with a predefined (and possibly recursive) DTD D that, given an instance I of a relational schema R, computes an XML view Tequal to σ(I), such that T conforms to D. Given that a DTD D is a set of productions, an ATG associates a set of semantic rules with each production and a single semantic attribute with each element type in D. These rules govern the production of child elements for each element based on the data present in the attribute.
A number of techniques are known for maintaining many kinds of materialized views, such as relational tables, object oriented databases and html pages extracted out of databases. Generally, the materialized views are maintained by keeping the “view” synchronized with the source data, by modifying the view each time the base changes. Thus, when the view is requested, it is up-to-date and can be delivered without further effort. Such view updates, however, are not available for XML publishing.
A number of techniques have been proposed or suggested for mapping XML view queries to Structured Query Language (SQL) queries that compute root-to-leaf paths in a relational encoding of the XML tree. These techniques, however, cannot be directly applied to generating or updating ATG-generated documents due to a lack of support for recursion. A DTD is recursive if it is based on an element type that is defined (directly or indirectly) in terms of itself. A natural and typical way to generate an XML document is through recursive rules. It has been recognized that linear recursion of SQL 99 is sufficient to support XPath queries over shredded XML data, even when the shredding schema is recursive, and that this approach could be applied for publishing queries. Nonetheless, a need still exists for a method and apparatus for incremental maintenance of schema-directed XML views that support recursion.